﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DataEmpty.aspx.cs" Inherits="ncp.Web.cms.work.SystemManager.DataEmpty" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>数据清空</title>
    <script src="../../js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function onfresh() {
    	    var rand = Math.random() * 1000;
    	    $("#checkImage").attr("src", "/work/VerificationCode.aspx?" + rand);
    	}
        function onEmptyData() {
            var pwd = $("#pwd").val();
            var code = $("#verifycode").val();
            if (pwd=="") {
                alert("必须先输入您的登录密码！");
                $("#pwd").focus();
                return;
            }
            if ($.trim(code)=="") {
                alert("验证码不能为空！");
                $("#verifycode").focus();
                return;
            }
            var data_obj = "";
            if ($("#Checkbox1").attr("checked"))
                data_obj += "A,";
            if ($("#Checkbox2").attr("checked"))
                data_obj += "B,";
            if ($("#Checkbox3").attr("checked"))
                data_obj += "C,";
            if ($("#Checkbox4").attr("checked"))
                data_obj += "D,";
            if ($("#Checkbox5").attr("checked"))
                data_obj += "E,";
            if ($("#Checkbox6").attr("checked"))
                data_obj += "F,";
            if ($("#Checkbox7").attr("checked"))
                data_obj += "G,";
            if ($("#Checkbox8").attr("checked"))
                data_obj += "H,";
            if ($("#Checkbox9").attr("checked"))
                data_obj += "I,";
            if ($("#Checkbox10").attr("checked"))
                data_obj += "J,";
            if (confirm("您确定要这样做吗，此操作将清除所有网站数据，且不可恢复，建议操作前先做好备份！")) {
                var response = ncp.Web.cms.work.SystemManager.DataEmpty.EmptyData(pwd, code, data_obj);
                if (response.value != "") {
                    var jsonOBJ = eval(response.value)[0];
                    alert(jsonOBJ.msg);
                    if (jsonOBJ.isreload) {
                        $("#verifycode,#pwd").val("");
                        onfresh();
                    }
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="font-size: 12px;border:solid 1px red;padding:10px;background-color:#FBEC88;">
        警告：该页面只作为网站初始化使用，该操作将会导致数据库数据和用户文件被永久删除。在操作之前请确认你是否需要这样做，并做好数据备份！
    </div>
    <div style="line-height: 25px;font-size:12px;height:25px; margin:5px;"><label for="pwd">登陆密码：</label>
       <input type="password" id="pwd" style="width: 150px;"/>
    </div>
    <div style="line-height: 25px;font-size:12px;height:25px; margin:5px;"><label for="verifycode">验&nbsp;证&nbsp;码：</label>
    <input type="text" class="alltxt" style="width: 50px;" name="verCode" id="verifycode" />
    <img id="checkImage" style="vertical-align: bottom;" src="/work/VerificationCode.aspx" width="60" height="25"  alt="验证码"　title="验证码" />
    <span style="font-size: 9pt;"><a href="javascript:void(0)" onclick="onfresh()">换一张</a></span>
    </div>
    <div style="font-size: 12px;border:solid 1px red;padding:10px;background-color:#FBEC88;">
        <input id="Checkbox1" type="checkbox" />清空商品类别及商品资料数据；<br />
        <input id="Checkbox2" type="checkbox" />清空qnrt数据；<br />
        <input id="Checkbox3" type="checkbox" />清空文章数据；<br />
        <input id="Checkbox4" type="checkbox" />清空产品数据；<br />
        <input id="Checkbox5" type="checkbox" />清空客户数据（包括留言与评论）；<br />
        <input id="Checkbox6" type="checkbox" />清空超链接数据；<br />
        <input id="Checkbox7" type="checkbox" />清空系统日志数据（包括登录日志与操作日志）；<br />
        <input id="Checkbox8" type="checkbox" />清空系统用户数据（系统管理员除外）；<br />
        <input id="Checkbox9" type="checkbox" />清空搜索关键字数据；<br />
        <input id="Checkbox10" type="checkbox" />清空所有文件数据（包括广告图片，产品图片，文章图片等）；<br />
    </div>
    <input type="button" value="清空网站数据" style="padding:2px 3px;margin:5px;" onclick="onEmptyData();"/>
    </form>
</body>
</html>
